package com.zjitc.mapper;

import com.zjitc.pojo.User;
import com.zjitc.pojo.UserExtend;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Create By IntelliJ IDEA
 *
 * @author: myq
 * @create-Time: 2017/11/7  16:12
 */
@Component
public interface UserMapper {

    /**
     * 通过username找到user
     *
     * @param username
     * @return
     */
    User findbyusername(@Param("username") String username);

    /**
     * 通过uid找到user
     *
     * @param uid
     * @return
     */
    User findbyid(@Param("uid") String uid);

    /**
     * 新建用户
     *
     * @param user
     * @return
     */
    int add(User user);

    /**
     * 更新用户信息
     *
     * @param user
     */
    int update(User user);

    /**
     * 分页查找用户
     *
     * @param pageid
     * @param count
     * @return
     */
    List<User> findlimit(@Param("pageid") int pageid, @Param("count") int count);

    /**
     * 删除用户
     *
     * @param uid
     */
    int deluser(@Param("uid") String uid);

    /**
     * 查看用户数量
     *
     * @return
     */
    int findcount();

    /**
     * 查找所有用户信息
     *
     * @return
     */
    List<User> findAll();


    /**
     * 通过uid 找username
     *
     * @param uid
     * @return
     */
    String findusernameByuid(String uid);

    int updateIntegral(@Param("integral") Integer integral, @Param("uid") String uid);

    List<User> findSearch(String username);

    String getUserphone(String uid);

    //------------------------live
    UserExtend getUserExtendInfoByUid(String uid);


}
